#pragma once
#include "CSocketClient.h"
#include "apiScreenCatchSocketClient.h"

typedef struct ST_SCREENCATCH_OBJ {
	int id;
	int row;
	int column;
	int x;
	int y;
	int w;
	int h;
	BITMAPINFO bmpInfo;
	BYTE* lastBytes;
	int nBytes;
	HWND hWnd;
	HDC label_dc;

	int threadId;

	HDC display_dc;
	HDC bitmap_dc;
	HBITMAP hbitmap;
	HGDIOBJ null_obj;

	HDC r_bitmap_dc;
	HBITMAP r_hbitmap;
	HGDIOBJ r_null_obj;

	bool isInit = false;

	char* bmpData = nullptr;
	~ST_SCREENCATCH_OBJ() {
		if (bmpData)delete[] bmpData;
	}
}SCREENCATCHOBJ;
class CScreenCatchSocketClient : public CSocketClient
{
public:
	void* m_cbScreenCatch;
	SCREENCATCH_PARAM m_param;
	int t_nBytes;
	int t_widthBytes;
	BITMAPINFO m_bmpInfo;
	SCREENCATCHOBJ m_catchObj;

public:
	~CScreenCatchSocketClient();
	bool InitScreenObj();
	void ReleaseScreenObj();
	void setBlockDataNew(int w, int h, const BYTE* bitmapBits, int size, int widthBytes, int nBytes, BITMAPINFO* bi);
	virtual bool PreAccept();
	virtual void OnRead(int);
};

